/*
 * CS_DASH.cpp
 *
 *  Created on: 2013. 5. 21.
 *      Author: the2
 */

#include "../../User.h"
#include "CS_DASH.h"

#include "../../NLogic/Static.h"
#include "../../NLogic/Battle.h"

namespace ProjectZ { namespace NCommand { namespace NAction {

void CS_DASH::OnExecute(User * pUser, ::Network::Packet * pPacket)
{
	/*
	 * CS_DASH	0x0410	12
	 * 		4	unsigned int	GID
			2	posx	x 좌표
			2	posy	y 좌표
			2	degree	이동벡터정보
			2	speed	속도


		SC_DASH	0x0411	12
			4	unsigned int	GID
			2	posx	x 좌표
			2	posy	y 좌표
			2	degree	이동벡터정보
			2	speed	속도
	 *
	 */

	NLogic::Space * pSpace = pUser->GetSpace();
	if (NULL == pSpace)
		return;

	PREPARE_PACKET;

	unsigned int GID = 0;
	int16_t x = 0;
	int16_t y = 0;
	int16_t degree = 0;
	int16_t speed = 0;

	* pPacket >> GID >> x >> y >> degree >> speed;

	// 고성종 차장 요청으로 죄표 저장 삭제....
	// Position
//	pUser->player_info.x = x;
//	pUser->player_info.y = y;
//	pUser->player_info.degree = degree;
//	pUser->player_info.speed = speed;

//	if (pSpace->GetData()._spaceType == NLogic::Space::SpaceType::BATTLEROYAL)
//	{
//		pUser->GetBattleRoyalBattle()->GetData().x = x;
//		pUser->GetBattleRoyalBattle()->GetData().y = y;
//		pUser->GetBattleRoyalBattle()->GetData().degree = degree;
//		pUser->GetBattleRoyalBattle()->GetData().speed = speed;
//	}
//	else
//	{
//		pUser->GetBattle()->GetData().x = x;
//		pUser->GetBattle()->GetData().y = y;
//		pUser->GetBattle()->GetData().degree = degree;
//		pUser->GetBattle()->GetData().speed = speed;
//	}

	::Network::Packet * pNoti = ::Network::GETPACKETPOOL()->SEND_NEW();
//	* pNoti << pUser->GetUserSeq() << x << y << degree << speed;
	* pNoti << GID << x << y << degree << speed;
	pNoti->MakePacket(CMD_SC_DASH);

	pSpace->SendAllExceptMe(pNoti, pUser);
}

} /*NAction*/ } /*NCommand*/ } /*ProjectZ*/
